{include file="public/header" /}
<style type="text/css">.gray-bg{ background: #fff; } .wrapper{ padding:0px;}.layui-form-checkbox i{height: 30px!important;}</style>
<body class="gray-bg" id="body">
<div class="wrapper wrapper-content">
    <div class="row">
        <form class="form-horizontal" method="post">
            <div class="col-sm-12">
                <div class="ibox-content">
                    {if !input('get.id')}
                    <div class="form-group">
                        <label class="col-sm-2 control-label">随机生成：</label>
                        <div class="col-sm-9"> <a class="btn btn-primary" href="{:url('member/add',['random'=>-1])}">随机</a>
                        </div>
                    </div>
                    {/if}
                    <div class="form-group">
                        <label class="col-sm-2 control-label">用户类型：</label>
                        <div class="col-sm-9">
                            <div class="radio i-checks">
                                {foreach $types as $type_key =>$type_value}
                                <label>
                                    <input type="radio" name="type" value="{$type_key}" {if (isset($name.type) && $name.type eq $type_key) || (!isset($name.type) && $type_key==0)}checked="checked"{/if} /> {$type_value}
                                </label>
                                {/foreach}
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">手机：</label>
                        <div class="col-sm-9">
                            <input name="username" type="text" class="form-control" value="{$name.username|default=''}" onkeyup="this.value=this.value.replace(/[^\d]/g, '')" maxlength="11" />
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">头像：</label>
                        <div class="col-sm-9">
                            <div class="input-group">
                                <input type="text" name="avatar" id="image" value="{$name.avatar|default=""}" class="form-control" />
                                <span class="input-group-btn">
                                    <button type="button" class="btn btn-primary" id="upload">上传头像</button>
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">常驻城市：</label>
                        <div class="col-sm-9" id="area">
                            <div class="col-sm-4">
                                <select name="province" class="form-control">
                                    <option value="0">省 [直辖市、自治 (特别行政)区]</option>
                                    {foreach $province as $value => $pn}
                                    <option value="{$value}" {if !empty($name.province) and ($name.province eq $value)}selected="selected"{/if}>{$pn}</option>
                                    {/foreach}
                                </select>
                            </div>
                            <div class="col-sm-3" id="city" {if empty($city)}style="display:none;"{/if}>
                            <select name="city" class="form-control">
                                <option value="0">市 [市(自治、行政)辖区]</option>
                                {foreach $city as $value => $cn}
                                <option value="{$value}" {if isset($name.city) and ($name.city eq $value)}selected="selected"{/if}>{$cn}</option>
                                {/foreach}
                            </select>
                        </div>
                        <div class="col-sm-2" id="district" {if empty($district)}style="display:none;"{/if}>
                        <select name="district" class="form-control">
                            <option value="0">区</option>
                            {foreach $district as $value => $dn}
                            <option value="{$value}" {if isset($name.district) and $name.district eq $value}selected="selected"{/if}>{$dn}</option>
                            {/foreach}
                        </select>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">经纬度：</label>
                <div class="col-sm-9"> <a class="btn btn-primary" onClick="newOpen('{:url('coordinatePicking')}','坐标拾取')">设置</a>
                    &nbsp; &nbsp;
                    <span id="longitude_latitude">
                                  经度：{$name.longitude|default='未设置'}  纬度：{$name.latitude|default='未设置'}
                    </span>
                </div>
            </div>
            {if $address}
            <div class="form-group">
                <label class="col-sm-2 control-label">当前位置：</label>
                <div class="col-sm-9">
                    <span style="display: block;padding-top:5px;" id="address">{$address}</span>
                </div>
            </div>
            {/if}

                    <div class="form-group">
                        <label class="col-sm-2 control-label">昵称：</label>
                        <div class="col-sm-9">
                            <input name="nickname" type="text" class="form-control" value="{$name.nickname|default=''}" />
                        </div>
                    </div>


            <div class="form-group date_time">
                <label class="col-sm-2 control-label">出生日期：</label>
                <div class="col-sm-9">
                    <input type="text" name="birthday" class="layui-input" id="birthday" value="{$name.birthday|default=''}" >
                </div>

            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">微信号：</label>
                <div class="col-sm-9">
                    <input name="wechat" type="text" class="form-control" value="{$name.wechat|default=''}" />
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">微信隐藏：</label>
                <div class="col-sm-9">
                    <div class="radio i-checks">
                        <label>
                            <input type="radio" name="wechat_hide" value="1" {if !isset($name.wechat_hide) or $name.wechat_hide eq 1}checked="checked"{/if} /> 是
                        </label>
                        <label>
                            <input type="radio" name="wechat_hide" value="0" {if isset($name.wechat_hide) and $name.wechat_hide eq 0}checked="checked"{/if} /> 否
                        </label>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">性别：</label>
                <div class="col-sm-9">
                    {if !input('get.id')}
                    <select name="sex" class="form-control">
                        {foreach $sexs as $sex=>$sex_name}
                        <option value="{$sex}"  {if isset($name.sex) and $name.sex eq $sex}selected="selected"{else}{/if}>{$sex_name}</option>
                        {/foreach}
                    </select>
                    {else}
                    <div class="form-control">
                        <input type="hidden" name="sex" value="{$name.sex}" readonly="readonly" />
                        {$sexs[$name['sex']]}
                    </div>
                    {/if}

                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">是否真人：</label>
                <div class="col-sm-9">
                    <div class="radio i-checks">
                        <label>
                            <input type="radio" name="real_verify" value="1" {if !isset($name.real_verify) or $name.real_verify eq 1}checked="checked"{/if} /> 是
                        </label>
                        <label>
                            <input type="radio" name="real_verify" value="0" {if isset($name.real_verify) and $name.real_verify eq 0}checked="checked"{/if} /> 否
                        </label>
                    </div>
                </div>
            </div>

            {if input('get.id') && $name.real_verify && !$name.video_verify}
            <div class="form-group">
                <label class="col-sm-2 control-label">是否女神：</label>
                <div class="col-sm-9">
                    <div class="radio i-checks">
                        <label>
                            <input  type="radio" name="video_verify" value="1" {if !isset($name.video_verify) or
                                   $name.video_verify eq 1}checked="checked" {/if} /> 是
                        </label>
                        <label>
                            <input type="radio" name="video_verify" value="0" {if isset($name.video_verify) and
                                   $name.video_verify eq 0}checked="checked" {/if} /> 否
                        </label>
                    </div>
                </div>
            </div>
            {/if}



            <div class="form-group">
                <label class="col-sm-2 control-label">交友节目</label>
                <div class="col-sm-9 layui-form">
                    {foreach $content_type_list as $content_type}
                    <input style="height: 30px;" type="checkbox"  name="content_type_list[]" {if $content_type['checked']}checked="checked"{/if} title="{$content_type['name']}" value="{$content_type['name']}" />
                    {/foreach}

                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">期望对象</label>
                <div class="col-sm-9 layui-form">
                    {foreach $expect_object_list as $expect_object}
                    <input style="height: 30px;" type="checkbox"  name="expect_object_list[]" {if $expect_object['checked']}checked="checked"{/if} title="{$expect_object['name']}" value="{$expect_object['name']}" />
                    {/foreach}

                </div>
            </div>



                    <div class="form-group">
                        <label class="col-sm-2 control-label">身高：</label>
                        <div class="col-sm-9">
                            <select name="height" class="form-control">
                                {for start="139" end="192"}
                                <option value="{$i}" {if isset($name.height) and $name.height eq $i}selected="selected"{/if}>{if $i<140}140cm以下{elseif $i>190}190cm以上{else}{$i}cm{/if}</option>
                                {/for}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">体重：</label>
                        <div class="col-sm-9">
                            <select name="weight" class="form-control">
                                {for start="39" end="92"}
                                <option value="{$i}" {if isset($name.weight) and $name.weight eq $i}selected="selected"{/if}>{if $i<40}40kg以下{elseif $i>90}90kg以上{else}{$i}kg{/if}</option>
                                {/for}
                            </select>
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-sm-2 control-label">职业：</label>
                        <div class="col-sm-9">
                            <select name="profession" class="form-control">
                                {foreach $profession_list as $profession}
                                <option value="{$profession}" {if isset($name.profession) and $name.profession eq $profession}selected="selected"{/if}>{$profession}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>







                    <div class="form-group">
                        <label class="col-sm-2 control-label">是否公司：</label>
                        <div class="col-sm-9">
                            <div class="radio i-checks">
                                <label>
                                    <input type="radio" {if isset($name.is_company)}disabled="disabled"{/if}  name="is_company" lay-filter="company" value="1" {if isset($name.is_company) and $name.is_company eq 1}checked="checked"{/if} /> 是
                                </label>
                                <label>
                                    <input type="radio" {if isset($name.is_company)}disabled="disabled"{/if} name="is_company" lay-filter="company" value="0" {if !isset($name.is_company) or $name.is_company eq 0}checked="checked"{/if} /> 否
                                </label>
                            </div>
                        </div>
                    </div>

                    <div class="form-group" id="invite_code" {if isset($name.is_company) && $name.is_company eq 1} style="display: none;" {/if}>
                        <label class="col-sm-2 control-label">推荐人邀请码：</label>
                        <div class="col-sm-9">
                            <input name="recommend_invite_code"  type="text" {if isset($name.recommend_invite_code) and $name.recommend_invite_code neq '' and !input('?get.random')}readonly="readonly"{/if}class="form-control" value="{$name.recommend_invite_code|default=''}" />
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">状态：</label>
                        <div class="col-sm-9">
                            <div class="radio i-checks">
                                <label>
                                    <input type="radio" name="status" value="1" {if !isset($name.status) or $name.status eq 1}checked="checked"{/if} /> 启用
                                </label>
                                <label>
                                    <input type="radio" name="status" value="0" {if isset($name.status) and $name.status eq 0}checked="checked"{/if} /> 禁用
                                </label>
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">是否合伙人：</label>
                        <div class="col-sm-9">
                            <div class="radio i-checks">
                                <label>
                                    <input type="radio" name="identity" value="0" {if !isset($name.identity) || $name.identity eq 0}checked="checked"{/if} /> 否
                                </label>
                                <label>
                                    <input type="radio" name="identity" value="1" {if isset($name.identity) && $name.identity eq 1}checked="checked"{/if} /> 是
                                </label>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <input type="hidden" name="id" value="{$name.id|default=0}" />
            <input name="longitude" id="longitude" type="hidden" class="form-control" value="{$name.longitude|default=''}" />
            <input name="latitude" id="latitude" type="hidden" class="form-control" value="{$name.latitude|default=''}" />
        </form>
    </div>
</div>
{include file="public/footer" /}
<script type="text/javascript" src="__STYLE__/admin/js/area.js?ver=20200522"></script>
{load href="__STYLE__/admin/plugins/iCheck/icheck.min.js"}
{load href="__STYLE__/admin/plugins/iCheck/custom.css"}
<script type="text/javascript">
$(document).ready(function(){
    $(".i-checks").iCheck({
        checkboxClass: "icheckbox_square-green",
        radioClass: "iradio_square-green",
    });
});


$("[name='is_company']").on("ifChecked",function () {
    var is_company = $(this).val();
   if(is_company==1){
        $("#invite_code").hide();
   }else{
       $("#invite_code").show();
   }
})

layui.use('laydate', function () {
    //时间选择器
    layui.laydate.render({
        elem: '#birthday'
        , type: 'date'
    });

});

layui.use('form', function(){
    var form = layui.form;
});

$("#upload").click(function(){
    layer.open({
        type: 2,
        title: '上传图片',
        shadeClose: true,
        shade: 0.2,
        area: ['70%', '60%'],
        skin:'shangchuantup',
        content: "{:url('index/upload', ['type' => 'avatar'])}",
        shift:-1,
        scrollbar: false,
        moveType: 1,
        moveOut: true
    });
});
function newOpen(url,title){
    var height = $(window).height();
    var width = $(window).width();
    var top =  (window.screen.height-height)/2;
    var left =  (window.screen.width-width)/2;

    var address = "";
    if($("#address").length>0){
        address =$("#address").text();
    }

    if(address==""){
        console.log(123123);
        var province_obj = $("select[name='province']");
        var city_obj = $("select[name='city']");
        var district_obj = $("select[name='district']");
        if(province_obj.val()!=0) address+=province_obj.find("option:selected").text();
        if(city_obj.val()!=0)address+=city_obj.find("option:selected").text();
        if(district_obj.val()!=0) address+=district_obj.find("option:selected").text();
    }



    window.open(url+'?address='+address,title,'top='+top+',left='+left+',width='+width+',height='+height)
}

function getCity(){

}

</script>
{include file="public/bottom" /}